<?php

/**
 * @package   auto_occasion
 * @subpackage 
 * @author    CMS
 * @copyright 2011
 * @license    All rights reserved
 **/

class annonceParutionSrv {

    /**
    * LIste des parutions d'une annonce
    */
    public function liste(){
        // instanciation de la factory
        $maFactory = jDao::get("commun~ao_annonce_parution");

        $records = $maFactory->findAll();

        return $records->fetchAll();
    }
    
    /*
     * recuperer le numero de parution 
     */
    public static function getParutionNum($date){
        $sql  = ' SELECT parution_num FROM ao_parution';
        $sql .= ' WHERE parution_date > DATE(\''.$date.'\')';
        $sql .= ' ORDER BY parution_date ASC LIMIT 1';
        $jdb        = jDb::getDbWidget();
        $tabNum     = $jdb->fetchAll($sql);
        $num        = 0;
        if(sizeof($tabNum)> 0) $num = $tabNum[0]->parution_num;
        return $num;
    }



}
